%%%-------------------------------------------------------------------
%%% @author Administrator
%%% @copyright (C) 2019, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 24. 12月 2019 15:22
%%%-------------------------------------------------------------------
-author("Administrator").
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%进程字典
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%玩家在线状态
-define(PLAYER_ONLINE_STATUS, player_online_status).
-define(PLAYER_STATUS_LOGIN, 1).%登录|大厅
-define(PLAYER_STATUS_NONE, 0).
-define(PLAYER_STATUS_IN_GAME, 2).%游戏中
-define(PLAYER_STATUS_LOGOUT, 3).%退出
%%玩家ws ConnPid
-define(PLAYER_WS_CONN_PID, player_ws_connPid).
%%玩家状态
-define(PLAYER_STATE, player_state).
%%当前所在游戏
-define(ONLINE_GAME_ID, online_game_id).
%%当前所在房间
-define(ONLINE_ROOM_ID, online_room_id).
%%登陆新账号
-define(LOGIN_ACCOUNT,0).
%%是否登出
-define(IS_LOGOUT,is_logout).
%%踢人状态
-define(KILLING,killing).


%%游戏id
-define(NIU_NIU, 2).%牛牛
-define(SAN_GONG, 4).%三公
-define(NIU_NIU_MING_PAI,8).%明牌
-define(WEI_NIU,13).%激情围牛

-define(GAME_SET,[?NIU_NIU,?SAN_GONG,?NIU_NIU_MING_PAI,?WEI_NIU_LINK_NAME]).

%%游戏ws地址名
-define(NIU_NIU_LINK_NAME,"niuniu").
-define(SAN_GONG_LINK_NAME,"sangong").
-define(NIU_NIU_MING_PAI_LINK_NAME,"qz-mingpai-niuniu").
-define(WEI_NIU_LINK_NAME,"chanzhuang_peri_cattle").

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%玩家数据记录
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-define(NEW_PLAYER, 1).
-define(NOT_NEW_PLAYER, 0).

%%玩家 ws 连接id
-record(player_protocol, {
  account :: string(),
  lobby :: pid(),%大厅
  niu_niu :: pid(),%牛牛
  san_gong :: pid(),%三公
  ming_pai:: pid()%明牌
}).

%%玩家基本信息
-record(player_info, {
  account :: string(),
  password :: string(),
  channel :: integer(),
  token :: string(),
  id :: string(),
  score :: integer(),%积分
  nickName :: string() | binary(),
  currentGame :: integer(),
  pid :: pid(),
  ws_connPid :: pid(),
  login_time :: integer(),
  logout_time :: integer(),
  is_new_player :: integer(),
  task_id :: integer(),
  group_id :: binary(),
  condition :: integer(),%任务输赢条件
  login_after_s :: integer()
}).
%%玩家状态
-record(player_state, {
  id :: string(),
  ws_connPid :: pid(),
  pid :: pid(),
  token :: string(),
  account :: string(),
  password :: string(),
  game_id :: integer(),
  room_id :: string(),
  game_pid :: pid(),
  task_id :: integer(),
  room_type :: integer(),
  group_id :: string(),
  is_look_bet = false :: boolean(),%是否旁观玩家
  is_room = false :: boolean() %是否在房间里
}).

%%房间数据
-record(room_data, {
  id :: string(), %唯一id
  account :: string(),%账号
  room_id :: integer(),%房间id
  create_date :: string(),%创建时间
  invalid_date :: string(),%过期时间
  game_type :: integer(),%游戏id
  runtime :: integer(), %运行时长（秒）
  player_count :: integer(), %人数
  money_type = 0 :: integer(),%货币类型
  type :: 0 | 1 |2 | 3,  %0俱乐部 1联盟 2战队 3个人
  allow_integral :: integer(),%最少带入积分
  group_id :: string(),
  max_people :: integer()%最大人数
}).

-type room_data_list() :: [#room_data{}] | list().

-record(room_info, {
  account :: string(),
  room_list = [] :: room_data_list()
}).

-record(player_into_room,{
  account :: string(),
  rooms :: list()
}).

-record(player_data,{
  account :: string(),
  password :: string(),
  is_new_player :: integer(),
  status = 0 :: integer()
}).






